# -*- coding: utf-8 -*-
# @Time : 2021/7/5 下午4:25
# @Author : fugang_le

import re

from src.similar_engine.synonym_transform import transform



def special_process(text, classification):
    if classification == '安全自动装置':
        match = re.search(r'[（/(].+?[）/)]', text)
        if match and len(match.group()) > 9:
            text = re.sub(r'[（/(].+?[）/)]', '', text)
    return text


def input_preprocess(text, classification):
    text = text.strip().lower()
    text = transform(text)
    text = special_process(text, classification)
    return text